

#ifndef LIDAR_AI_DATA_H
#define LIDAR_AI_DATA_H

#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <opencv2/core.hpp>


struct LiDARFrame {
    long long time_stamp = 0;
    cv::Point3f fusepose;  // x, y, z
    cv::Point3f rpy;       // roll, pitch, yaw
};

// AI 数据结构
struct AIFrame {
    long long time_stamp = 0;
    std::vector<cv::Point3f> xyz;  // 障碍物坐标
};

// 匹配后的数据结构
struct MatchedFrame {
    long long lidar_time_stamp;
    long long ai_time_stamp;
    cv::Point3f fusepose;
    cv::Point3f rpy;
    std::vector<cv::Point3f> xyz;
    long long diff;
    size_t pcl_no;
};


std::vector<AIFrame> loadAIData(const std::string& path);
std::vector<LiDARFrame> loadLiDARData(const std::string& path);
std::vector<MatchedFrame> matchingPoseWithAI(const std::vector<AIFrame>& ai_data, const std::vector<LiDARFrame>& li_data);
void findMinMaxXY(const std::vector<MatchedFrame>& frames, 
                  float& min_x, float& max_x, 
                  float& min_y, float& max_y);


std::vector<MatchedFrame> readAndParseData(const std::string& file_name);

#endif // LIDAR_AI_DATA_H
